﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace UCS.XNA.Utils.Animation
{
    public abstract class FadeAnimation
    {
        #region Attributes and Properties

        protected float _speed;
        public float Speed
        {
            get { return this._speed; }
            set { this._speed = value; }
        }

        #endregion

        #region Private Members

        protected IFadeAnimatable _animatable;

        #endregion

        #region Events

        public virtual event EventHandler<EventArgs> AnimationFinished;

        #endregion

        #region Constructors

        public FadeAnimation(IFadeAnimatable animatable, float speed)
        {
            this._animatable = animatable;
            this._speed = speed;
        }

        #endregion

        #region Public Methods

        public abstract void Update(GameTime gameTime);

        #endregion

        #region Protected Methods

        protected void RaiseAnimationFinishedEvent()
        {
            if (this.AnimationFinished != null)
                this.AnimationFinished(this, new EventArgs());
        }

        #endregion
    }
}
